// pages/carcircle/othermy/othermy.js
const utils = require("../../../utils/util.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    shopSummary: {
      "ShopID": 0,
      "UserName": "",
      "ShopName": "",
      "HeadImgSrc": "/imgs/icon-userhead-placeholder.png",
      "PostCount": 0
    }
  },
  /**
 * 用户点击右上角分享
 */
  onShareAppMessage: function (res) {
    if (res.from === 'menu') {
      // 来自页面右上角转发按钮
      return {
        title: '快来上车务圈，更多人脉，更多订单！限时免费注册！',
        path: '/pages/index/index',
        imageUrl: '/imgs/share-banner.jpg'
      };
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    that.getMyShop(options.shopid);
  },
  getMyShop: function (shopid) {
    var that = this;
    utils.getData(
      utils.apiUrl + "/shop/GetShopSummary?shopid=" + shopid,
      {},
      function (response) {
        that.setData({
          shopSummary: response.data
        });
      }
    );
  },
  bindShopDetail: function () {
    var that = this;
    wx.navigateTo({
      url: '/pages/my/shopdetail/shopdetail?shopid=' + that.data.shopSummary.ShopID
    })
  },
  bindMyPost: function () {
    var that = this;
    wx.navigateTo({
      url: '/pages/my/mypost/mypost?shopid=' + that.data.shopSummary.ShopID
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    utils.checkLogin(function () {

    }, function () {
      wx.navigateTo({
        url: '../my/login/login',
      })
    });
  },
  /**   
    * 预览图片  
    */
  previewImage: function (e) {
    var that = this
    var arr = [];
    arr.push(that.data.shopSummary.HeadImgSrc);
    wx.previewImage({
      current: that.data.shopSummary.HeadImgSrc, // 当前显示图片的http链接  
      urls: arr // 需要预览的图片http链接列表  
    })
  }


})